package com.lion.ball.modules.orderfood.service.assistants.converters;

import java.sql.Timestamp;
import com.lion.common.base.utils.ConvertUtil;
import com.lion.common.base.utils.DbUtil;
import com.lion.common.spring.annotations.DataConverter;
import com.lion.common.spring.business.base.BaseConverter;
import com.lion.utils.TimeUtil;
import com.lion.ball.modules.orderfood.domain.entity.OfdFoodSkuOptionEntity;
import com.lion.ball.modules.orderfood.web.model.params.create.OfdFoodSkuOptionCreateParam;
import com.lion.ball.modules.orderfood.web.model.params.update.OfdFoodSkuOptionUpdateParam;
import com.lion.ball.modules.orderfood.web.model.results.OfdFoodSkuOptionResult;

/**
 * @author Chris Chan
 * Create on 2025-10-18 13:33
 * Use for: 食品选项 业务数据转换助手
 * Explain:
 * 
 */
@DataConverter
public class OfdFoodSkuOptionConverter implements BaseConverter<
        OfdFoodSkuOptionEntity,
        OfdFoodSkuOptionCreateParam,
        OfdFoodSkuOptionUpdateParam,
        OfdFoodSkuOptionResult> {
    @Override
    public OfdFoodSkuOptionEntity fromParam(OfdFoodSkuOptionCreateParam param) {
        OfdFoodSkuOptionEntity entity = new OfdFoodSkuOptionEntity();
        ConvertUtil.copyProperties(param, entity, "id");
        // 生成编码
        entity.setCode(DbUtil.buildCode());
        return entity;
    }

    @Override
    public OfdFoodSkuOptionEntity fromUpdateParam(OfdFoodSkuOptionUpdateParam param) {
        OfdFoodSkuOptionEntity entity = ConvertUtil.convert(param, OfdFoodSkuOptionEntity.class);
        return entity;
    }

    @Override
    public OfdFoodSkuOptionResult toResult(OfdFoodSkuOptionEntity entity) {
        OfdFoodSkuOptionResult result = ConvertUtil.convert(entity,OfdFoodSkuOptionResult.class);
        return result;
    }
}